Ext.define('House.view.HousePanel', {
	extend : 'Ext.Container',
	xtype : 'housepanel',
	store : 'House.store.House',
	requires : ['Ext.List', 'House.store.House', 'House.model.House',
			'Ext.SegmentedButton'],
	config : {
		items : [{
					xtype : 'toolbar',
					title : '房间浏览',
					docked : 'top'
				}, {
					xtype : 'container',
					docked : 'top',
					margin:'10 0 0 0',
					layout : {
						type : 'vbox',
						align : 'center'
					},
					items : [{
								xtype : 'segmentedbutton',
								items : [{
											text : '普通房'
										}, {
											text : '标准房'
										}, {
											text : '商务房'
										}],
								listeners : {
									toggle : function(con, button, isPressed) {
										if (isPressed) {
							                var text = button.get('text'),flag;
							                if(text == "普通房"){
							                	flag = 1;
							                }else if(text == "标准房"){
							                	flag = 2;
							                }else{
							                	flag = 3;
							                }
											Ext.getCmp('houseList').getStore().load({
							                    params : { htype:flag}
							                });
										}
									}
								}
							}]
				}, {
					xtype : 'list',
					id : 'houseList',
					margin:'10 0 0 0',
					height:380,
					store : {
						type : 'houseStore'
					},
					itemTpl : new Ext.XTemplate(
							'<tpl for=".">',
							'<div class="house_img"><img src="{url}" title="{hno}" height="60" width="60"></div>',
							'<div class="house_desc"><h2>{hno}</h2><p>{content}</p></div>',
							'<div class="house_price">${price}</div>',
							'<div style="clear: both"></div></tpl>')
				}]
	}

});